package net.lovesrc.allin.biz.gogohome;

import net.lovesrc.allin.controller.BaseController;
import net.lovesrc.allin.jobs.GogoHomeRegisterJob;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/gogohome")
public class GogoHomeController extends BaseController {


    @Autowired
    GogoHomeRegisterJob gogoHomeRegisterJob;
    @Autowired
    GogoHomeLoginSign gogoHomeLoginSign;

    @GetMapping("/register/start")
    public String registerStart() {
        gogoHomeRegisterJob.flag.set(true);
        return "ok";
    }

    @GetMapping("/register/stop")
    public String registerStop() {
        gogoHomeRegisterJob.flag.set(false);
        return "ok";
    }
    @GetMapping("/login/start")
    public String loginStart() {
        gogoHomeLoginSign.login();
        return "ok";
    }

    @GetMapping("/convert")
    public String convert(String phone, @RequestParam(defaultValue = "0", required = false) long number) {
        gogoHomeLoginSign.mgtConvert(phone, number);
        return "ok";
    }

}
